package at.codebase.db.dao;

import static at.codebase.db.OfyService.ofy;

import java.util.List;

import at.codebase.db.entities.EApiPartner;

public class EApiPartnerDao {
	
	public static void saveApiPartner(final EApiPartner apiPartner) {
		ofy().save().entity(apiPartner).now();
	}

	public static List<EApiPartner> getApiPartnerList() {
		return ofy().load().type(EApiPartner.class).list();
	}

	public static EApiPartner getApiPartner(Long partnerId) {
		if(partnerId.longValue() <= 0)
			return null;
		return ofy().load().type(EApiPartner.class).filter("partnerId", partnerId).first().get();
	}

	public static void removePartner(final EApiPartner partnerEntity) {
		ofy().delete().entity(partnerEntity).now();
	}
	
}
